﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace SharpSoft.WPF.Converters
{
    /// <summary>
    /// 对数值进行简单的计算
    /// </summary>
    public class CalculateConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            try
            {
                var v = System.Convert.ToDouble(value);
                return v + AddValue;
            }
            catch (Exception)
            {
                throw;
            }

        }

        public double AddValue { get; set; }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return value;
        }
    }
}
